Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NU-1928] Fix special case for spel toMap extension #7329

Open
wants to merge 5 commits into
base: staging
Choose a base branch
from

Conversation

paw787878
Copy link
Contributor

@paw787878 paw787878 commented Dec 13, 2024

Describe your changes

Checklist before merge

  • Related issue ID is placed at the beginning of PR title in [brackets] (can be GH issue or Nu Jira issue)
  • Code is cleaned from temporary changes and commented out lines
  • Parts of the code that are not easy to understand are documented in the code
  • Changes are covered by automated tests
  • Showcase in dev-application.conf added to demonstrate the feature
  • Documentation added or updated
  • Added entry in Changelog.md describing the change from the perspective of a public distribution user
  • Added MigrationGuide.md entry in the appropriate subcategory if introducing a breaking change
  • Verify that PR will be squashed during merge

case m: JMap[_, _] => m.keySet().containsAll(keyAndValueNames)
case _ => false
case m: JMap[_, _] => m.keySet().containsAll(keyAndValueNames)
case _: java.util.Map.Entry[_, _] => true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java.util.Map.Entry -> JMap.Entry?

val map = new JHashMap[Any, Any]()
c.forEach {
case e: JMap[_, _] => map.put(e.get(keyName), e.get(valueName))
case e: java.util.Map.Entry[_, _] => map.put(e.getKey, e.getValue)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if e is not matched?

@@ -1663,6 +1663,42 @@ class SpelExpressionSpec extends AnyFunSuite with Matchers with ValidatedValuesD
}
}

test("should convert list of map entries into map") {
// this is a special case
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove these comments because it's says only that we didn't handle sth in the past and now test proves that we handle this situation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants